package com.bojiu.lawsearch.lawsearch.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;

/**
 * @author: afdiao
 * @Date：2020/3/24 22:36
 * @Description:
 */
@Table(name = "log")
@Data
@ApiModel("积分以及金额变动明细")
public class Log {

    @Column(name = "id")
    private Integer id;

    /**
     * 用户id
     */
    @Column(name = "userId")
    @ApiModelProperty("用户id")
    private Integer userId;

    /**
     * 用户昵称
     */
    @Transient
    @ApiModelProperty("用户昵称")
    private String userNickname;

    /**
     * 变动之前的值
     */
    @Column(name = "`before`")
    @ApiModelProperty("变动之前的值")
    private String before;

    /**
     * 变动的值
     */
    @Column(name = "`value`")
    @ApiModelProperty("变动的值")
    private String value;

    /**
     * 变动之后的值
     */
    @Column(name = "`after`")
    @ApiModelProperty("变动之后的值")
    private String after;

    /**
     * 1 积分历史
     * 2 余额历史
     */
    @Column(name = "type")
    @ApiModelProperty("1 积分历史，2 余额历史")
    private Integer type;

    /**
     * 操作明细
     */
    @Column(name = "detail")
    @ApiModelProperty("操作明细")
    private String detail;

    @Transient
    private String userName;

    /**
     * 创建日期
     */
    @Transient
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date addTime;
}
